package day01.DateFormat类.SimpleDateFormat类;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * @author feng
 * @Date 2022/1/3 10:47
 */
public class SimpleDateFormatTest {
    public static void main(String[] args) {
        String s = "2022-10-19 10:54:09";
        Date s1 = null;
        String patten = "yyyy-MM-dd HH:mm:ss";
        //按第一个模板解析，第二个模板格式化
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(patten);
        SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
        try {
            //解析文本字符串
            s1 = simpleDateFormat.parse(s);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        String format = simpleDateFormat1.format(s1);
        System.out.println(format);

    }
}
